﻿<UserControl xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             mc:Ignorable="d"
             xmlns:controls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls"
             xmlns:controlsToolkit="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Toolkit"
             xmlns:control="clr-namespace:PhotoBrowserAg"
             x:Class="PhotoBrowserAg.MainPage"
             d:DesignWidth="640"
             d:DesignHeight="480">
    <UserControl.Resources>
        <control:ImageUriConverter x:Key="converter" />
    </UserControl.Resources>
    <UserControl.Background>
        <LinearGradientBrush EndPoint="0.5,1"
                             StartPoint="0.5,0">
            <GradientStop Color="Black"
                          Offset="0" />
            <GradientStop Color="White"
                          Offset="1" />
        </LinearGradientBrush>
    </UserControl.Background>
    <Grid x:Name="LayoutRoot">
    	<VisualStateManager.VisualStateGroups>
    		<VisualStateGroup x:Name="StateGroup">
    			<VisualStateGroup.Transitions>
    				<VisualTransition  From="Ready" GeneratedDuration="00:00:00"  To="Waiting">
    					<Storyboard>
    						<ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="shade" Storyboard.TargetProperty="(UIElement.Visibility)" Duration="00:00:00.0010000">
    							<DiscreteObjectKeyFrame KeyTime="00:00:00">
    								<DiscreteObjectKeyFrame.Value>
    									<Visibility>Visible</Visibility>
    								</DiscreteObjectKeyFrame.Value>
    							</DiscreteObjectKeyFrame>
    						</ObjectAnimationUsingKeyFrames>
    						<ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="txtShade" Storyboard.TargetProperty="(UIElement.Visibility)">
    							<DiscreteObjectKeyFrame KeyTime="00:00:00">
    								<DiscreteObjectKeyFrame.Value>
    									<Visibility>Visible</Visibility>
    								</DiscreteObjectKeyFrame.Value>
    							</DiscreteObjectKeyFrame>
    						</ObjectAnimationUsingKeyFrames>
    						<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="txtShade" Storyboard.TargetProperty="(UIElement.Opacity)">
    							<EasingDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
    							<EasingDoubleKeyFrame KeyTime="00:00:01" Value="1"/>
    						</DoubleAnimationUsingKeyFrames>
    					</Storyboard>
    				</VisualTransition>
    				<VisualTransition From="Waiting" GeneratedDuration="00:00:00" To="Ready">
    					<Storyboard>
    						<ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="shade" Storyboard.TargetProperty="(UIElement.Visibility)" Duration="00:00:00.0010000">
    							<DiscreteObjectKeyFrame KeyTime="00:00:00">
    								<DiscreteObjectKeyFrame.Value>
    									<Visibility>Collapsed</Visibility>
    								</DiscreteObjectKeyFrame.Value>
    							</DiscreteObjectKeyFrame>
    						</ObjectAnimationUsingKeyFrames>
    						<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="txtShade" Storyboard.TargetProperty="(UIElement.Opacity)">
    							<EasingDoubleKeyFrame KeyTime="00:00:00.5000000" Value="0"/>
    						</DoubleAnimationUsingKeyFrames>
    					</Storyboard>
    				</VisualTransition>
    			</VisualStateGroup.Transitions>
    			<VisualState x:Name="Ready"/>
    			<VisualState x:Name="Waiting">
    				<Storyboard>
    					<ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="txtShade" Storyboard.TargetProperty="(UIElement.Visibility)">
    						<DiscreteObjectKeyFrame KeyTime="00:00:00">
    							<DiscreteObjectKeyFrame.Value>
    								<Visibility>Visible</Visibility>
    							</DiscreteObjectKeyFrame.Value>
    						</DiscreteObjectKeyFrame>
    					</ObjectAnimationUsingKeyFrames>
    					<ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="shade" Storyboard.TargetProperty="(UIElement.Visibility)">
    						<DiscreteObjectKeyFrame KeyTime="00:00:00">
    							<DiscreteObjectKeyFrame.Value>
    								<Visibility>Visible</Visibility>
    							</DiscreteObjectKeyFrame.Value>
    						</DiscreteObjectKeyFrame>
    					</ObjectAnimationUsingKeyFrames>
    				</Storyboard>
    			</VisualState>
    		</VisualStateGroup>
    	</VisualStateManager.VisualStateGroups>
        <Grid.Background>
            <LinearGradientBrush EndPoint="0.5,1"
                                 StartPoint="0.5,0">
                <GradientStop Color="Black"
                              Offset="0" />
                <GradientStop Color="White"
                              Offset="1" />
                <GradientStop Color="#FF575757"
                              Offset="0.914" />
            </LinearGradientBrush>
        </Grid.Background>
        <Grid.RowDefinitions>
            <RowDefinition />
            <RowDefinition Height="40" />
        </Grid.RowDefinitions>

        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="0.294*" />
            <ColumnDefinition Width="0.706*" />
        </Grid.ColumnDefinitions>
        <controls:TreeView x:Name="daTree"
                           FontFamily="{StaticResource defaultFontFamily}"
                           FontSize="{StaticResource defaultFontSize}"
                           Margin="10" />
        <Image x:Name="splash"
               Margin="5"
               Grid.Column="1"
               Source="splash.png" HorizontalAlignment="Center" VerticalAlignment="Center" Width="400" Height="140" />
        <ScrollViewer HorizontalScrollBarVisibility="Disabled"
                      VerticalScrollBarVisibility="Auto"
                      Grid.Column="1" Margin="0,10">
        	<ScrollViewer.BorderBrush>
        		<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
        			<GradientStop Color="#FFA3AEB9" Offset="0"/>
        			<GradientStop Color="#FF090D10" Offset="1"/>
        			<GradientStop Color="#FFE1E7EC" Offset="1"/>
        		</LinearGradientBrush>
        	</ScrollViewer.BorderBrush>
            <ItemsControl x:Name="PhotoList"
                          Margin="0"
                          Grid.Column="1"
                          Grid.RowSpan="2">
                <ItemsControl.ItemsPanel>
                    <ItemsPanelTemplate>
                        <controlsToolkit:WrapPanel Orientation="Horizontal"
                                                   Margin="10" />
                    </ItemsPanelTemplate>
                </ItemsControl.ItemsPanel>
                <ItemsControl.ItemTemplate>
                    <DataTemplate>
                        <Image Height="62"
                               Width="67"
                               Margin="5"
                               HorizontalAlignment="Right"
                               VerticalAlignment="Bottom"
                               Stretch="Uniform"
                               Source="{Binding ThumbnailUrl, Converter={StaticResource converter}}"
                               MouseLeftButtonDown="wrapper_MouseLeftButtonDown" />
                    </DataTemplate>
                </ItemsControl.ItemTemplate>
            </ItemsControl>
        </ScrollViewer>
        <Button HorizontalAlignment="Left"
                Margin="10,8,0,10"
                Width="55"
                Content="options"
                FontFamily="{StaticResource defaultFontFamily}"
                FontSize="{StaticResource defaultFontSize}"
                Grid.Row="1" />
        <Rectangle x:Name="shade"
                   Fill="White"
                   Stroke="Black"
                   Margin="0"
                   Grid.ColumnSpan="2"
                   Opacity="0" Grid.RowSpan="2" Visibility="Collapsed" />
        <TextBlock x:Name="txtShade" Margin="10,0,0,0" RenderTransformOrigin="1.222,0.814" Text="Please wait..." TextWrapping="Wrap" Grid.Column="1" Grid.Row="1" HorizontalAlignment="Left" VerticalAlignment="Center" Visibility="Collapsed">
        	<TextBlock.Foreground>
        		<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
        			<GradientStop Color="Black" Offset="0"/>
        			<GradientStop Color="#FFC5AFAF" Offset="1"/>
        		</LinearGradientBrush>
        	</TextBlock.Foreground>
        </TextBlock>
    </Grid>
</UserControl>
